﻿using Castle.Core.Logging;
using System;

namespace Yto.Common.logging
{
    public static class LogExtenstions
    {
        public static void Log(this ILogger logger, LogLevel level, string message)
        {
            switch (level)
            {
                case LogLevel.Debug:
                    logger.Debug(message);
                    break;
                default:
                    throw new BaseException($"The LogLevel \'{level}\' is not correct!");
            }
        }

        public static void Log(this ILogger logger, LogLevel level, string message, Exception exception)
        {
            switch (level)
            {
                case LogLevel.Debug:
                    logger.Debug(message, exception);
                    break;
                default:
                    throw new BaseException($"The LogLeve \'{level}\' is not correct!");
            }
        }
    }
}
